package com.whj.internalcommon.utils;

/**
 * @Auther: wanghaijun
 * @Date: 2023/1/2 - 01 - 02 - 13:48 
 * @Description: com.whj.internalcommon.utils
 */

public class RedisTokenKeyUtils {

    //乘客验证码的前缀
    public static String verificationCodePrefix = "verification-";

    //token的前缀
    public static String tokenPrefix = "token-";

    //黑名单设备的前缀
    public static String blackDeviceCodePrefix = "black-device-";

    /**
     * 根据手机号生成key
     *
     * @param phone    手机号
     * @param identity 身份标识
     * @return
     */
    public static String keyByPhone(String phone, String identity) {
        return verificationCodePrefix + identity + "-" + phone;
    }

    /**
     * 根据手机号和身份标识生成redis保存token的key
     *
     * @param passengerPhone
     * @param identity
     * @return
     */
    public static String keyByTokenMsg(String passengerPhone, String identity, String tokenType) {
        return tokenPrefix + passengerPhone + "-" + identity + "-" + tokenType;
    }
}
